<template>
	<view>
		<div class="community_img">
			<image :src="communityInfo.communityImage" mode=""></image>
		</div>
		<up-cell-group>
			<up-cell title="社区名称" :value="communityInfo.communityName"></up-cell>
			<up-cell title="社区所在省份" :value="communityInfo.provincesName"></up-cell>
			<up-cell title="社区所在城市" :value="communityInfo.citiesName"></up-cell>
			<up-cell title="社区所在区县" :value="communityInfo.districtsName"></up-cell>
			<up-cell title="社区地址" :value="communityInfo.communityAddress"></up-cell>
			<up-cell title="创建时间" :value="handleTime(communityInfo.createTime)"></up-cell>

		</up-cell-group>
	</view>
</template>

<script setup>
	import {
		onLoad
	} from '@dcloudio/uni-app'
	import {
		ref
	} from 'vue';
	import {
		apiGetDetails
	} from "@/api/user.js"
	const communityId = ref(null)

	const communityInfo = ref({
		communityId: null,
		communityName: '',
		communityAddress: '',
		pageSize: 10,
		page: 1,
		provincesId: null,
		citiesId: null,
		districtsId: null,
		provincesName: '',
		citiesName: '',
		districtsName: '',
	})
	

	//处理时间
	const handleTime = (time)=>{
		if(time == null){
			return ""
		}
		return time.split("T")[0]
	}
	onLoad(async (option) => {
		communityId.value = option.communityId
		let res = await apiGetDetails(communityId.value)
		communityInfo.value = res.data

	})
</script>

<style scoped lang="scss">
	.community_img {
		width: 100vw;
		display: flex;
		justify-content: center;
		margin: 20rpx 0;
		image {
			width: 200rpx;
			height: 200rpx;
		
		}
	}
</style>
